from kuai.sim import setup_model, SimulationJob
from kuai.mol.io import read_molfile
from kuai.sim.dff2kuai import read_ppffile
from kuai.sim.efunc import make_efunc
from kuai.unit import default_units
from numpy import dot
from math import sqrt

mol = read_molfile('C2H6.msd')

index, parameters = read_ppffile('C2H6.ppf')
model = setup_model(mol, index, parameters)

funcs = make_efunc(model, index)
fe = default_units.format(1, 'kcal/mol')
fg = default_units.format(1, 'kcal/mol A')
fh = default_units.format(1, 'kcal/mol A A')

for i in funcs:
    print i.name

job = SimulationJob()
e1       = job.getE(model, funcs)
e2, g2    = job.getEG(model, funcs)
e3, g3, h3 = job.getEGH(model, funcs)

print e1 - e2;
print e3 - e2;
print g3 - g2;


print e3 * fe[0]
print g3 * fg[0]
print h3 * fh[0]
